<?php

class Zax_App_User extends Zax_App_Default_File
{
	
	public function getProfile()
	{
		static $profile;
		if($profile) return $profile;
		
		$profile = unserialize($this->File_getData());
		
		return $profile;
	}
	
	public function getAuthID()
	{
		$profile = $this->getProfile();
		return sha1($profile['username'].md5($profile['password']));
	}
	
	public function setUserInfos($infos)
	{
		$old_profile = $this->getProfile();
		$new_profile = array_merge((array) $old_profile,$infos);

		$this->File_putData(serialize($new_profile));
	}
}